cmake_minimum_required (VERSION 2.6)
project (OXYGINE_FREETYPE)

if (EMSCRIPTEN)
	set(CMAKE_CXX_FLAGS "-Wno-warn-absolute-paths -s USE_FREETYPE=1")
	set(OXYGINE_FREETYPE_INCLUDE_DIRS 
		${CMAKE_CURRENT_SOURCE_DIR}/src)

	set(OXYGINE_FREETYPE_CXX_FLAGS "-s USE_FREETYPE=1")
elseif(MINGW)
	set(OXYGINE_FREETYPE_INCLUDE_DIRS 
	${CMAKE_CURRENT_SOURCE_DIR}/src
	${CMAKE_CURRENT_SOURCE_DIR}/freetype/mingw/include)

	set(OXYGINE_FREETYPE_LIBS
	${CMAKE_CURRENT_SOURCE_DIR}/freetype/mingw/libfreetype.dll)
elseif(MSVC)
	set(OXYGINE_FREETYPE_INCLUDE_DIRS 
		${CMAKE_CURRENT_SOURCE_DIR}/src
		${CMAKE_CURRENT_SOURCE_DIR}/freetype/win32/include)

	set(OXYGINE_FREETYPE_LIBS
		${CMAKE_CURRENT_SOURCE_DIR}/freetype/win32/freetype.lib)
else()
	find_package(Freetype REQUIRED)

	set(OXYGINE_FREETYPE_INCLUDE_DIRS 
                ${CMAKE_CURRENT_SOURCE_DIR}/src)

	set(OXYGINE_FREETYPE_LIBS ${FREETYPE_LIBRARIES})
	include_directories(${FREETYPE_INCLUDE_DIRS})


endif(EMSCRIPTEN)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")

include_directories(${OXYGINE_FREETYPE_INCLUDE_DIRS})
add_library(oxygine-freetype STATIC 
	src/ResFontFT.cpp 
	src/ResFontFT.h
)


set(OXYGINE_FREETYPE_INCLUDE_DIRS ${OXYGINE_FREETYPE_INCLUDE_DIRS} PARENT_SCOPE)
set(OXYGINE_FREETYPE_LIBS ${OXYGINE_FREETYPE_LIBS} PARENT_SCOPE)
set(OXYGINE_FREETYPE_CXX_FLAGS
	${OXYGINE_FREETYPE_CXX_FLAGS}
	PARENT_SCOPE)

include(../shortPath.cmake)
redefine_file_macro(oxygine-freetype)
set(CMAKE_CXX_FLAGS "-Wno-builtin-macro-redefined")
